package com.googlecode.eventio.internal.utils;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;

public class NamedThreadFactory implements ThreadFactory {
	private final String name;
	private AtomicLong count = new AtomicLong(0);

	public NamedThreadFactory(String name) {
		super();
		this.name = name;
	}

	@Override
	public Thread newThread(Runnable r) {
		return new Thread(r, name + "-" + (count.incrementAndGet()));
	}
}